#include "aicommandproximitydialogreponse.h"

namespace IAlib
{

AiCommandProximityDialogReponse::AiCommandProximityDialogReponse()
{
    AiCommand::setType(COMMAND_PROXIMITY_DIALOG_REPONSE);
}

QByteArray AiCommandProximityDialogReponse::toByteArray() const
{
    QByteArray byte_array;
    QDataStream data(&byte_array, QIODevice::WriteOnly);

    data<<getMode();
    data<<getIdOrigine();
    data<<getIdTarget();
    data<<getReponseStatus();

    return byte_array;
}

void AiCommandProximityDialogReponse::fromByteArray(QByteArray &byte_array)
{
    QDataStream data(&byte_array, QIODevice::ReadOnly);
    int i_temp;
    QString s_temp;
    data>>i_temp;
    setMode((CommandMode)i_temp);
    data>>s_temp;
    setIdOrigine(s_temp);
    data>>s_temp;
    setIdTarget(s_temp);
    data>>m_reponse_status;
}

}
